<div class="row-fluid">
    <div class="span12">
        <div class="box corner-all">
            <div class="box-header grd-white corner-top">
                <div class="header-control">
                    <a data-box="collapse"><i class="icofont-caret-up"></i></a>
                </div>
                <span><?= lang('label_menu_link_stores') ?></span>
            </div>
            <div class="box-body">
                <form action="<?= base_url() ?><?= get_segment(1) ?>/<?= get_segment(2) ?>/all" method="post" style="margin-bottom: 5px;" >
                    <table id="datatablestools" class="table table-hover responsive">
                        <div class="row-fluid">
                            <div class="span6"></div>
                        </div>
                        <thead>
                            <tr>
                                <th><?= lang('label_name') ?></th>
                                <th><?= lang('label_owner') ?></th>
                                <th><?= lang('label_menu_link_products') ?></th>
                                <th><?= lang('label_complaints_num') ?></th>
                                <th><?= lang('label_subscriber') ?></th>
                                <th><?= lang('label_menu_link_packages') ?></th>
                                <th><?= lang('label_created_date') ?></th>
                                <th><?= lang('label_tool') ?></th>
                            </tr>
                        </thead>
                        <tbody>
                            <? foreach ($result as $value) { ?>
                                <tr class="gradeA" <?php if ($value->active == 'NO') echo 'style="background-color: #f7e4e4;color: red"' ?> >
                                    <td class="w300"><a <?= ($value->active == 'NO') ? '' : 'target="_blank"' ?> href="<?= ($value->active == 'NO') ? 'javascript:void(0)' : base_url(ADMIN_FOLDER . '/' . get_segment(2) . '/view/' . $value->id) ?>"><?php
                                            $name = get_store_name_by_id($value->id);
                                            echo ($name) ? $name : lang('label_not_active_yet')
                                            ?></a></td>
                                    <td><a href="<?= base_url(ADMIN_FOLDER . "/users/view/$value->owner_id") ?>"><?= get_username_with_id($value->owner_id) ?></a></td>
                                    <td><?= get_store_products_num($value->id) ?></td>
                                    <td><?= get_store_complaints($value->id) ?></td>
                                    <td><?= get_subscribers_count($value->id) ?></td>
                                    <td><a class="getpop" href="<?= base_url(ADMIN_FOLDER . "/stores/pkdetails/$value->id") ?>"><?= get_package_name($value->package_id) ?></a></td>
                                    <td><?= timespan($value->create_date) ?></td>
                                    <td class="center">
                                        <div class="btn-group">
                                            <button class="btn  dropdown-toggle" data-toggle="dropdown"><i class="icon-cog"></i>  <?= lang('label_operation') ?> <span class="caret"></span></button>
                                            <ul class="dropdown-menu">
                                                <?php if ($value->active == 'NO') { ?>
                                                    <li><a href="<?= base_url() . ADMIN_FOLDER ?>/<?= get_segment(2) ?>/active/<?= $value->id ?>"><i  class="icon-edit"></i> <?= lang('label_active') ?></a></li>
                                                <?php } else { ?>
                                                    <li><a target="_blank" href="<?= base_url(ADMIN_FOLDER . '/' . get_segment(2) . '/view/' . $value->id) ?>"><i  class="icon-edit"></i> <?= lang('label_edit') ?></a></li>
                                                    <li><a href="<?= base_url() . ADMIN_FOLDER ?>/<?= get_segment(2) ?>/deactive/<?= $value->id ?>"><i  class="icon-edit"></i> <?= lang('label_deactive') ?></a></li>
                                                <?php } ?>

                                            </ul> 
                                        </div>

                                    </td>
                                </tr>
                            <?php } ?>
                        </tbody>
                    </table>
                    <div class="row-fluid">

                    </div>
            </div>
            </form>
            <?= $pagination ?>
        </div><!-- /box-body -->
    </div><!-- /box -->
</div><!-- /span -->
</div><!--/datatables tools-->

<div id="action_load_mudle">
    <!-- action contant  -->

</div>